﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display {
    import flash.events.*;
    import Engine.Managers.*;
    import flash.display.*;
    import Classes.*;
    import com.greensock.*;
    import Engine.*;

    public class SWFDialog extends Dialog {

        protected var m_dialogAsset:String = null;
        protected var m_loader:Loader;

        public function SWFDialog(_arg1:Boolean=true){
            super(_arg1);
            if (this.m_dialogAsset){
                this.m_loader = LoadingManager.load(Global.getAssetURL(this.m_dialogAsset), this.onLoaderEvent);
                this.visible = false;
            };
        }
        private function onLoaderEvent(_arg1:Event):void{
            if (((this.m_loader) && (this.m_loader.content))){
                m_content = this.m_loader.content;
            };
            this.onLoadComplete();
            onDialogInitialized();
        }
        protected function onLoadComplete():void{
        }
        protected function addIcon(_arg1:String, _arg2:DisplayObjectContainer, _arg3:Boolean=false, _arg4:Number=60, _arg5:Number=60):void{
            var _local7:int;
            var _local8:DisplayObject;
            var _local6:Loader = LoadingManager.load(_arg1, Delegate.create(this, this.iconLoaded, _arg2, _arg3, _arg4, _arg5));
            if (_arg2.parent){
                _local7 = _arg2.numChildren;
                while (_local7 > 0) {
                    _local8 = _arg2.getChildAt((_local7 - 1));
                    TweenLite.killTweensOf(_local8);
                    if ((_local8 is Loader)){
                        LoadingManager.cancelLoad(Loader(_local8));
                    };
                    _arg2.removeChildAt((_local7 - 1));
                    _local7--;
                };
            };
            _arg2.addChild(_local6);
        }
        protected function iconLoaded(_arg1:Event, _arg2:DisplayObjectContainer, _arg3:Boolean=false, _arg4:Number=60, _arg5:Number=60):void{
            var _local6:LoaderInfo = (_arg1.target as LoaderInfo);
            if (!((_local6) && (_local6.content))){
                return;
            };
            if (_local6.loader.parent != _arg2){
                return;
            };
            if (_arg2.parent){
                Utilities.removeAllChildren(_arg2);
            };
            var _local7:DisplayObject = Utilities.getSmoothableBitmap(_local6.content);
            _local7.width = _arg4;
            _local7.height = _arg5;
            if (_arg3){
                _local7.x = (-(_arg4) / 2);
                _local7.y = (-(_arg5) / 2);
            };
            _local7.alpha = 0;
            TweenLite.to(_local7, 0.1, {alpha:1});
            _arg2.addChild(_local7);
        }

    }
}//package Display 
